package com.lxyk.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

@Component
@EnableBinding(Sink.class)//消息接收方
public class MessageListenerController {
    @Value("${server.port}")
    private int serverPort;

    @StreamListener(Sink.INPUT)
    public void input(Message<String> message){//Message是底层写好的
        System.out.println("消费者8802:"+message.getPayload()+"\t"+"port:"+serverPort);
    }

}
